

package org.privat24.api.misc;

import java.util.HashMap;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class TagAttributesReader extends DefaultHandler {

    private final HashMap<String, String> attributesMap;
    
    public TagAttributesReader(HashMap<String, String> attributesMap){
        super();
        this.attributesMap = attributesMap;
    }

    @Override
    public void startElement(String uri, String localName, String qName,Attributes attributes) throws SAXException {

        int length = attributes.getLength();
        
        for (int i=0; i<length; i++) {
            String name = attributes.getQName(i);
            String value = attributes.getValue(i);
            attributesMap.put(name, value);
        }

    }

    public HashMap<String, String> getParsedAttributesMap() {
        return attributesMap;
    }
    
    

}